package com.csgc.camera.widget.dialog

import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.view.Gravity
import android.widget.ImageView
import androidx.annotation.StyleRes
import com.csgc.camera.util.clickWithTrigger
import com.csgc.camera.widget.dialog.base.AnimAction
import com.csgc.camera.widget.dialog.base.BaseDialog
import com.cysd.spsyxj.R
import com.hjq.shape.view.ShapeTextView
import com.hjq.toast.ToastUtils


class ContactUsDialog constructor(
    context: Context,
    @StyleRes themeResId: Int = R.style.BaseDialogTheme
) :
    BaseDialog(context, themeResId) {
    private val copyQQ: ShapeTextView? by lazy { findViewById(R.id.tv_copy_qq) }
    private val ivClose: ImageView? by lazy { findViewById(R.id.iv_close) }

    init {
        setContentView(R.layout.dialog_contact_us)
        setWindowAnimations(AnimAction.ANIM_IOS)
        setGravity(Gravity.CENTER)

        copyQQ?.clickWithTrigger {
            //获取剪贴板管理器：
            val cm: ClipboardManager? =
                context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager?
            val mClipData = ClipData.newPlainText("Label", "1458269835")
            cm?.setPrimaryClip(mClipData)
            ToastUtils.show("复制成功！")
            dismiss()
        }

        ivClose?.clickWithTrigger {
            dismiss()
        }
    }


}